
<div id="page-heading"><input type="button" value="Add Home Highlight" style="float: right;" id="admin-add-product"><h1>Home Highlight</h1></div>

<form action="<?php echo site_url('admin/save_home_highlight'); ?>" method="post" encrypt-data>
	
	<table border="0" width="100%" cellpadding="0" cellspacing="0" id="product-table">
					<tbody><tr>
						<th class="table-header-repeat line-left"><a href="#">Picture</a>	</th>
						<th class="table-header-repeat line-left"><a href="#">ID</a>	</th>
						<th class="table-header-repeat line-left"><a href="#">Title</a></th>
						<th class="table-header-repeat line-left"><a href="#">Link</a></th>
						<th class="table-header-options line-left"><a href="">Options</a></th>
					</tr>
					<?php foreach ($products as $product): ?>
						
					<tr>
						<td><img src="<?php echo config_item('asset'),'img/product/',$product['pic'] ?>" width="200" /></td>
						<td><?php echo $product['id'] ?></td>
						<td><?php echo $product['title'] ?></td>
						<td><?php echo $product['link'] ?></td>
						<td class="options-width">
							<a href="<?php echo site_url('admin/edit_home_highlight/'.$product['id']) ?>" title="Edit Home Highlight" class="icon-1 info-tooltip"></a>
							<a href="#" title="Delete Home Highlight" class="icon-2 info-tooltip home-highlight-delete" id="<?php echo $product['id']; ?>"></a>
						</td>
					</tr>
					
					<?php endforeach ?>
					</tbody></table>

</form>
<script type="text/javascript">
$('#admin-add-product').click(function(){
	window.location = '<?php echo site_url('admin/edit_home_highlight');?>';
});
$('.home-highlight-delete').click(function(e){
	e.preventDefault();
	if(confirm('ต้องการลบข้อมูลใช่หรือไม่?')){
		$.get('/admin/delete_home_highlight/'+this.id,function(data){
			alert('ลบข้อมูลเรียบร้อยแล้ว');
			location.reload();
		});
	}
})
</script>